/**
 * 水sh-ui
 */

import './tap';

import Iscroll from '../../components/vue-sh-ui/sh-iscroll.vue';
import Flow from '../../components/vue-sh-ui/sh-flow.vue';
import Flow_item from '../../components/vue-sh-ui/sh-flow-item.vue';
import List from '../../components/vue-sh-ui/sh-list.vue';
import List_item from '../../components/vue-sh-ui/sh-list-item.vue';
import Step from '../../components/vue-sh-ui/sh-step.vue';
import Step_item from '../../components/vue-sh-ui/sh-step-item.vue';
import Operlist from '../../components/vue-sh-ui/sh-operlist.vue';
import Btn from '../../components/vue-sh-ui/sh-btn.vue';
import Toasts from '../../components/vue-sh-ui/sh-toasts';
import Dialogs from '../../components/vue-sh-ui/sh-dialogs';
import Header from '../../components/vue-sh-ui/sh-header.vue';
import Picker from '../../components/vue-sh-ui/sh-picker.vue';
import CarSelector from '../../components/vue-sh-ui/sh-car-selector.vue';
import Dialog from '../../components/vue-sh-ui/sh-dialog.vue';
import Nav from '../../components/vue-sh-ui/sh-nav.vue';

var install = function (Vue, config = {}) {
  console.log("SHUI");
  if (install.installed) return;
  Vue.component(Iscroll.name, Iscroll);
  Vue.component(Flow.name, Flow);
  Vue.component(Flow_item.name, Flow_item);
  Vue.component(List.name, List);
  Vue.component(List_item.name, List_item);
  Vue.component(Step.name, Step);
  Vue.component(Step_item.name, Step_item);
  Vue.component(Operlist.name, Operlist);
  Vue.component(Btn.name, Btn);
  Vue.prototype.$dialog = {
    alert: Dialogs.Alert,
    confirm: Dialogs.Confirm
  };
  Vue.prototype.$toast = {
    show: Toasts.Show,
    success: Toasts.Success,
    fail: Toasts.Fail,
    loading: Toasts.Loading,
    close: Toasts.Close,
  };
  Vue.component(Header.name, Header);
  Vue.component(Picker.name, Picker);
  Vue.component(CarSelector.name, CarSelector);
  Vue.component(Dialog.name, Dialog);
  Vue.component(Nav.name, Nav);
};

// 移动端ios:active伪类失效的兼容解决：
document.body.addEventListener("touchstart", function () {
}); //空函数
// 利用Vue.user进行安装
if (typeof window !== "undefined" && window.Vue) {
  install(window.Vue);
}

export default {
  install,
  Iscroll,
  Flow,
  Flow_item,
  List,
  List_item,
  Step,
  Step_item,
  Operlist,
  Btn,
  Header,
  Picker,
  CarSelector,
  Dialog,
  Nav,
}
